package day1211_2;
//餐馆
class Resturant{
}

class Cooker extends Thread{
    Object o;
    Cooker(Object oo){
        o=oo;
    }
    public void run() {
        synchronized (o){
            System.out.println("洗菜");
            System.out.println("做饭");
            System.out.println("卖饭");
            o.notify();
        }
    }
}


class Customer extends Thread{
    Object o;
    Customer(Object oo){
        o=oo;
    }
    public void run() {
        synchronized (o){
            try {
                o.wait();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("点菜菜");
            System.out.println("付钱");
            System.out.println("吃饭");
        }
    }
}


public class T3 {
    public static void main(String[] args) {
        Resturant  shop=new Resturant();

        Cooker  chuShi=new Cooker(shop);
        chuShi.start();

        Customer  c=new Customer(shop);
        c.start();
    }
}
